<?php
//location 通用接口
Route::group(
    [
        'middleware' => 'api',
        'prefix' => 'api/location',
        'namespace' => 'Summer\Location\Http\Controllers',
    ],
    function () {
        //不需要登录到接口,原则是和用户无关到信息都不加auth
        //【地址】获取省份
        Route::post(
            'province/index',
            'ProvinceController@index'
        )->name('api.location.province.index');
        //【地址】获取城市
        Route::post(
            'city/index',
            'CityController@index'
        )->name('api.location.city.index');
        //【地址】获取区县
        Route::post(
            'area/index',
            'AreaController@index'
        )->name('api.location.area.index');
        //【地址】获取乡镇
        Route::post(
            'town/index',
            'TownController@index'
        )->name('api.location.town.index');

        //【省市县】shopro模版数据
        Route::post(
            'userAddress/area',
            'UserAddressController@area'
        )->name('api.location.userAddress.area');
        //需要登录次能显示
        Route::middleware(['Summer\Hub\Http\Middleware\HubJwtAuthMiddleware'])->group(
            function () {

                //【用户地址】添加地址
                Route::post(
                    'userAddress/create',
                    'UserAddressController@create'
                )->name('api.location.userAddress.create');
                //【用户地址】地址详情
                Route::post(
                    'userAddress/preview',
                    'UserAddressController@preview'
                )->name('api.location.userAddress.preview');
                //【用户地址】修改地址
                Route::post(
                    'userAddress/update',
                    'UserAddressController@update'
                )->name('api.location.userAddress.update');
                //【用户地址】删除地址
                Route::post(
                    'userAddress/delete',
                    'UserAddressController@delete'
                )->name('api.location.userAddress.delete');
                //【用户地址】我的地址
                Route::post(
                    'userAddress/index',
                    'UserAddressController@index'
                )->name('api.location.userAddress.index');
                //【用户地址】默认地址
                Route::post(
                    'userAddress/default',
                    'UserAddressController@default'
                )->name('api.location.userAddress.default');
            }
        );

    }
);



